package com.example.userclient.remote

import com.example.userclient.*
import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query


interface ApiService {
    companion object {
        //此类接口的基地址
        const val baseUrl = "http://www.laozhoy1.club:9200/api/v1/"
//        const val baseUrl = "http://localhost:9200/api/v1/"
    }

    @GET("getUserBooks")
    fun getUserBooks(): Call<ApiResponse<Set<AddBook>>>//由于json采用手动解，所以没有用泛型


    @GET("getUserBuyBooks")
    fun getUserBuyBooks(@Query(value = "phone") phone:String): Call<ApiResponse<Set<AddBookExtension>>>

    @GET("getUserSaleBooks")
    fun getUserSaleBooks(@Query(value = "phone") phone:String): Call<ApiResponse<Set<AddBookExtension>>>
    @GET("getRegisterClient")
    fun getRegisterClient(): Call<ApiResponse<Map<String, HeartBeatInfo>>>


    @GET("getRemarks")
    fun getAllRemark(@Query(value = "phone") phone:String):Call<ApiResponse<List<BookRemark>>>
    @GET("cancelRemark")
    fun cancelRemark(@Query(value = "phone") phone:String,@Query(value = "cancelId") cancelId:String):Call<ApiResponse<Any>>
    @POST("readRemark")
    fun readRemark(@Body readRemark: ReadRemark):Call<ApiResponse<Any>>
    @GET("addRemark")
    fun addRemark(@Query(value = "sendFrom") sendFrom:String,@Query(value = "sendTo") sendTo:String,
                  @Query(value = "content") content:String,@Query(value = "book_id") book_id:Long,
                  @Query(value = "self_id") self_id:String):Call<ApiResponse<BookRemark>>

}